<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>顶部</title>
    <link rel="stylesheet" href="./zhanshi.css">
    <script src="./js/jquery-3.6.0.min.js"></script>
</head>

<body>
    <!-- 顶部开始 -->
    <div class="top">
        <div class="logo"></div>
        <div class="search">
            <form>
                <input type="text" placeholder="请输入要查找的关键字" name="keyword" class="keyword">
                <select id="" name="type">
                    <option value="1">案例搜索</option>
                    <option value="2">方案搜索</option>
                    <option value="3">产品搜索</option>
                    <option value="4">新闻搜索</option>
                </select>
                <input type="button" class="search_btn" value="">
            </form>
        </div>
        <div class="contactUs">
            <span>全国服务热线:</span><br>
            <h4>
                <a href="#"></a>
            </h4>
        </div>
    </div>
    <!-- 顶部结束 -->
    <!-- 导航栏开始 -->
    <div class="nav">
        <div class="nav_lis">
            <ul>
                <li>
                    <a href="./index.php">网站首页<br><span>HOME</span></a>
                </li>
                <li>
                    <a href="./aboutus.php">关于战石<br><span>ABOUT US</span></a>
                    <ul class="lis">
                        <?php
                    include "./fun.php";
                    $db=conndb();
                    $list=get_Children_Class(2, $db);
                    $str='';
                    foreach ($list as $k=>$v) {
                        // $css=$k==0?"class='active'":'';
                        // $str.="<li><a href='aboutus.php?sortid={$v["id"]}' {$css}>{$v["sortname"]}</a></li>";
                        $str.="<li><a href='aboutus.php?sortid={$v["id"]}'>{$v["sortname"]}</a></li>";
                    }
                    echo $str;
                    ?>

                    </ul>
                </li>
                <li>
                    <a href="./cases.php">案例中心<br><span>CASE CENTER</span></a>
                    <ul class="lis">
                        <?php
                    $list=get_Children_Class(8, $db);
                    $str='';
                    foreach ($list as $v) {
                        $str.="<li><a href='cases.php?sortid={$v["id"]}'>{$v["sortname"]}</a></li>";
                    }
                    echo $str;
                ?>

                    </ul>
                </li>
                <li>
                    <a href="./solution.php">解决方案<br><span>SOLUTION</span></a>
                    <ul class="lis">
                        <?php
                    $list=get_Children_Class(13, $db);
                    $str='';
                    foreach ($list as $v) {
                        $str.="<li><a href='solution.php?sortid={$v["id"]}'>{$v["sortname"]}</a></li>";
                    }
                    echo $str;
                ?>
                        <!-- <li>
                        <a href="">室内LED高清拼</a>
                    </li>
                    <li>
                        <a href="">体育行业LED领</a>
                    </li>
                    <li>
                        <a href="">城综合体领域</a>
                    </li> -->
                    </ul>
                </li>
                <li>
                    <a href="./news.php">新闻资讯<br><span>NEWS</span></a>
                    <ul class="lis">
                        <?php
                    $list=get_Children_Class(17, $db);
                    $str='';
                    foreach ($list as $v) {
                        $str.="<li><a href='news.php?sortid={$v["id"]}'>{$v["sortname"]}</a></li>";
                    }
                    echo $str;
                ?>

                    </ul>
                </li>
                <li>
                    <a href="./product.php">产品中心<br><span>PRODUCT</span></a>
                    <ul class="lis">
                        <?php
                    $list=get_Children_Class(21, $db);
                    $str='';
                    foreach ($list as $v) {
                        $str.="<li><a href='product.php?sortid={$v["id"]}'>{$v["sortname"]}</a></li>";
                    }
                    echo $str;
                ?>

                    </ul>
                </li>
                <li><a href="./contactUS.php">联系我们<br><span>CONTACT US</span></a></li>
                <li><a href="./message.php">在线留言<br><span>MESSAGE</span></a></li>
            </ul>
        </div>
    </div>
    <!-- 导航栏结束 -->
    <script>
        $(function() {
            // 分类搜索事件开始

            $(".search_btn").on("click", function() {
                var keyword = $("input[name='keyword']").val();
                var type = $("select[name='type']").val();
                // console.log(keyword);
                switch (type) {
                    case '1':
                        if (keyword == '') {
                            alert("关键字不能为空");
                        } else {
                            location.href = "./cases.php?keyword=" + keyword + "&type=" + type;
                        }
                        break;
                    case '2':
                        if (keyword == '') {
                            alert("关键字不能为空");
                        } else {
                            location.href = "./solution.php?keyword=" + keyword + "&type=" + type;
                        }
                        break;
                    case '3':
                        if (keyword == '') {
                            alert("关键字不能为空");
                        } else {
                            location.href = "./product.php?keyword=" + keyword + "&type=" + type;
                        }
                        break;
                    case '4':
                        if (keyword == '') {
                            alert("关键字不能为空");
                        } else {
                            location.href = "./news.php?keyword=" + keyword + "&type=" + type;
                        }
                        break;
                }

            });
            // 分类搜索事件结束


            // 导航栏的鼠标经过事件开始
            // 鼠标经过时淡入淡出导航
            $(".nav_lis>ul>li").hover(function() {
                // stop()停止当前激活的动画，继续执行动画队列中的下一个动画
                $(this).children("ul").stop().fadeToggle(1000, "linear");
            });
            // 给每个导航的第一个li>a加上样式
            $(".lis").each(function() {
                $(this).children("li").eq(0).children("a").addClass("active");
            });
            // 鼠标经过
            $(".lis>li>a").hover(function() {
                $(this).addClass("active");
            }, function() {
                $(this).removeClass("active");
            });
            // 鼠标移出时，给第一个加上默认样式
            $(".nav_lis>ul>li>ul").on("mouseleave", function() {
                $(this).children("li").eq(0).children("a").addClass("active");
            })
            // 导航栏的鼠标经过事件开始


            // 系统项目设置开始
            $.ajax({
                url: "./sysset_list.php",
                dataType: "json",
                success: function(res) {
                    if (res.code == 0) {
                        // 读取logo
                        $(".logo").css("background", "url('./admin/upload/" + res.data.logo +
                            "') no-repeat left");
                        // 读取联系电话
                        $(".contactUs>h4>a").html(res.data.contactUs);
                    }
                }
            });
            // 系统项目设置结束
        })
    </script>
</body>

</html>